import React, { Component } from 'react';

import './style.less';
import 'weui';
import VideoList from './views/VideoList';
import PDFList from './views/PDFList';
import PDFViewer from './views/PDFViewer';
import VideoViewer from './views/VideoViewer';

import './App.css';
import {
  BrowserRouter as Router,
  Route
} from 'react-router-dom';


let routes = []
class App extends Component {

  componentWillMount() {
    this.state = {
      showNavBar: true
    };
    routes = [
      {
        path: '/videolist',
        exact: true,
        main: () => <VideoList/>
      },
        {
            path: '/pdflist',
            exact: true,
            main: () => <PDFList/>
        },
      {
        path: '/viewpdf/:id',
        exact: true,
        main: () => <PDFViewer/>
      },
      {
        path: '/viewvideo/:id',
        exact: true,
        main: () => <VideoViewer/>
      }

    ];
  }



  render() {
    return (
      <div>
        <Router>
            <div style={{ maxWidth: '100%', height: '100%', }}>
              {routes.map((route, index) => (
                <Route
                  key={index}
                  path={route.path}
                  exact={route.exact}
                  component={route.main}
                />
              ))}
            </div>

        </Router>

      </div>

    );
  }
}



export default App;
